<template>
  <div>
    <el-container>
      <el-header class="layout-header">
        <span  style="font-family: Hei; color: black ;line-height: 45px;font-size: 24px;font-weight: bolder">新冠物资管理</span>
        <span style="float: right;font-size: 15px">欢迎{{user.username}}回来!
                    <a href="javascript:void(0)" @click="logout()">退出登录</a>
                </span>
      </el-header>
      <el-container style="box-shadow: 0 2px 10px 2px rgba(0,0,0,0.8);"></el-container>
      <el-container class="layout-body">
        <el-aside class="layout-aside">
          <el-menu router="" text-color="#FFF" background-color="#009bb3" :default-active="this.$route.path">
            <el-menu-item index="/home">
              <i class="el-icon-s-home"></i>
              <span slot="title">首页</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin">
              <i class="el-icon-user-solid"></i>
              <span slot="title">个人中心</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/user">
              <i class="el-icon-s-custom"></i>
              <span slot="title">用户管理</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/emp">
              <i class="el-icon-s-check"></i>
              <span slot="title">员工管理</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/item/info">
              <i class="el-icon-s-ticket"></i>
              <span slot="title">物资信息管理</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/item/apply">
              <i class="el-icon-remove"></i>
              <span slot="title">物资申请管理</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/item/donation">
              <i class="el-icon-circle-plus"></i>
              <span slot="title">物资捐献管理</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/item/in">
              <i class="el-icon-circle-plus"></i>
              <span slot="title">物资入库管理</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/item/out">
              <i class="el-icon-remove"></i>
              <span slot="title">物资发放记录</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/message">
              <i class="el-icon-s-comment"></i>
              <span slot="title">留言板管理</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-menu-item index="/admin/manage/bbs">
              <i class="el-icon-s-promotion"></i>
              <span slot="title">论坛管理</span>
            </el-menu-item>
            <el-divider></el-divider>
            <el-submenu index="">
              <template slot="title">
                <i class="el-icon-s-tools"></i>
                <span  slot="title">系统管理</span>
              </template>
              <el-menu-item index="/admin/manage/news">疫情咨讯管理</el-menu-item>
              <el-menu-item index="/admin/manage/show">轮播图管理</el-menu-item>

            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <router-view :key="$route.fullPath"/>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>
<script>

  export default {
    data() {
      return {
        url:"",
        user:{
          id:"",
          username:"",
          name:"",
          idNumber:"",
          age:"",
          phone:"",
          email:"",
          isEnable:"",
          roleId:""
        },
      }
    },
    created() {
      this.getData();
    },

    methods: {
      getData(){
        this.user = JSON.parse(localStorage.getItem('user'))
      },
      logout(){
        localStorage.removeItem('JWT_TOKEN')
        localStorage.removeItem('user')
        this.$router.push({path: '/login'});  //页面路由刷新
      },
      goBack(){
        //返回上一页面
        history.back();
      }
    },
  }
</script>




<style>
  * {margin: 0}
  .layout-header{
    background: #009bb3;
    height: 45px !important;
    text-align: center;
  }
  .layout-aside{
    width: 190px !important;
    background-color: #009bb3;
  }
  .layout-body{
    margin: auto;
    position: absolute;top: 45px; bottom: 0;left: 0;right: 0;
  }
  ul.el-menu{
    background: unset;
  }
  .el-divider--horizontal{
    margin: 0;
  }
</style>